package test01.redis;

public abstract class BaseKeyPrefix implements KeyPrefix{

    private int expireSeconds;

    private String prefix;

    public BaseKeyPrefix(int expireSeconds, String prefix) {
        this.expireSeconds = expireSeconds;
        this.prefix = prefix;
    }

    public BaseKeyPrefix(String prefix) {
        this(0,prefix);
    }

    @Override
    public int getExpireSeconds() {
        return expireSeconds;
    }

    @Override
    public String getPrefix() {
        String classPath=getClass().getSimpleName();
        return classPath+":"+prefix;
    }
}
